home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1996 July
/
Macworld (1996-07).dmg
/
System 7.5 Update 2.0
/
FileMaker Pro 3.0 CD Extras
/
FileMaker And Apple Events
/
Sample Applications
/
Deleting Duplicates
/
Delete Duplicate Records
next >
Wrap
Text File
|
1996-01-25
|
939b
|
24 lines
set dupFile to "Duplicate Records Database" -- stores the name of the database
set dupCheck to "Unique ID" -- stores the name of the duplicate checking field
copy "" to lastRecord --sets up the variable lastRecord
copy 0 to numDeleted --sets up the variable numDeleted
tell application "FileMaker Pro" --activates FileMaker Pro
activate
show every record of database dupFile
sort layout 1 by field dupCheck
copy (count record of database dupFile) to recordCount --counts records
repeat with i from recordCount to 1 by -1
copy cell dupCheck of record i to thisRecord --copies record
if thisRecord = lastRecord then --compares record
delete record i --if duplicate, deletes record
copy 1 + numDeleted to numDeleted
else
copy thisRecord to lastRecord
end if
end repeat
display dialog (numDeleted as string) & ¬
" records were deleted" buttons {"OK"} default button 1
--displays number of records deleted
end tell